package pe.edu.sistemas.postgrado.samupg.business.service.impl.planificacion;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import pe.edu.sistemas.postgrado.samupg.business.service.planificacion.MaestriaDiplomadoService;
import pe.edu.sistemas.postgrado.samupg.domain.model.MaestriaDiplomado;
import pe.edu.sistemas.postgrado.samupg.repository.dao.MaestriaDiplomadoDAO;

/**
 *
 * @author Marlon
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class MaestriaDiplomadoServiceImpl implements MaestriaDiplomadoService {

    @Resource
    private MaestriaDiplomadoDAO maestriaDiplomadoDAO;

    @Override
    public List<MaestriaDiplomado> getMaestrias() {
        return maestriaDiplomadoDAO.getMaestrias();
    }

    @Override
    public List<MaestriaDiplomado> getDiplomados() {
        return maestriaDiplomadoDAO.getDiplomados();
    }

    @Override
    public MaestriaDiplomado getxNombre(String nombre) {
        return maestriaDiplomadoDAO.getxNombre(nombre);
    }

    @Override
    public MaestriaDiplomado getxId(Integer id) {
        return maestriaDiplomadoDAO.getxId(id);
    }

    @Override
    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    public void crearMaestriaDiplomado(MaestriaDiplomado maestriaDiplomado) throws DataAccessException {
        maestriaDiplomadoDAO.crearMaestriaDiplomado(maestriaDiplomado);
    }
}
